/**
 * 状态的流转
 */
public class ThreadDemoByState {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(new Runnable() {
            @Override
            public void run() {
                //拿到当前线程，并打印当前线程的状态
                Thread thread=Thread.currentThread();
                System.out.println("线程状态2:"+thread.getState());
            }
        });
        //打印线程的状态
        System.out.println("线程状态1:"+t.getState());
        t.start();
        //再次打印线程状态
        Thread.sleep(500);
        System.out.println("线程状态3:"+t.getState());
    }
}
